
// Cloud Float...
    var $main = $cloud = mainwidth = null;
    var offset1 = 450;
	var offset2 = 0;
	
	var offsetbg = 0;
    

   $(function(){
	   if(window != top) {
			top.location.href = location.href;
		}
	    $main = $("#mainBody");
		$body = $("body");
        $cloud1 = $("#cloud1");
	    $cloud2 = $("#cloud2");
        mainwidth = $main.outerWidth();
    $('.loginbox').css({'position':'absolute','left':($(window).width()-692)/2});
	$(window).resize(function(){  
    $('.loginbox').css({'position':'absolute','left':($(window).width()-692)/2});
    });
	
   });  


    /// 飘动
    setInterval(function flutter() {
        if (offset1 >= mainwidth) {
            offset1 =  -580;
        }

        if (offset2 >= mainwidth) {
			 offset2 =  -580;
        }
		
        offset1 += 1.1;
		offset2 += 1;
        $cloud1.css("background-position", offset1 + "px 100px")
		
		$cloud2.css("background-position", offset2 + "px 460px")
    }, 70);
	
	
	setInterval(function bg() {
        if (offsetbg >= mainwidth) {
            offsetbg =  -580;
        }

        offsetbg += 0.9;
        $body.css("background-position", -offsetbg + "px 0")
    }, 90 );
	
    var login = function(){
    	var loginuser = $('#loginuser').val()
    	var loginpwd  = $('#loginpwd').val();
    	if(""==$.trim(loginuser)){
    		alert('请填写用户名！');
    		return false;
    	}
    	
    	if(""==$.trim(loginpwd)){
    		alert('请填写用户密码！');
    		return false;
    	}
    	
    	$.ajax({
           	url:basePath+'sys/Manage/login',
        	data:{userName:loginuser,userPassword:loginpwd},
        	type:'post',
        	dataType:'json',
        	async:false,
        	success:function(result){
        	        if(typeof(result)=='undefined'){
        	        	alert('登陆异常！');
        	        	return false;
        	        }
        	        if(result.state!=200){
        	        	alert(result.message);
        	        	return false;
        	        }
        	        window.location.href = 'main.jsp';
        	        //$("#loginForm").attr('action','main.jsp');
        		},
        		complete:function(){
        		}
            });
    	
        };

	